package com.aeoj.management.service.impl;

import java.util.List;
import com.aeoj.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aeoj.management.mapper.ProblemMapper;
import com.aeoj.domain.management.Problem;
import com.aeoj.management.service.IProblemService;

/**
 * 题目Service业务层处理
 *
 * @author zsm
 * @date 2025-04-01
 */
@Service
public class ProblemServiceImpl implements IProblemService
{
    @Autowired
    private ProblemMapper problemMapper;

    /**
     * 查询题目
     *
     * @param id 题目主键
     * @return 题目
     */
    @Override
    public Problem selectProblemById(Long id)
    {
        return problemMapper.selectProblemById(id);
    }

    /**
     * 查询题目列表
     *
     * @param problem 题目
     * @return 题目
     */
    @Override
    public List<Problem> selectProblemList(Problem problem)
    {
        return problemMapper.selectProblemList(problem);
    }

    /**
     * 新增题目
     *
     * @param problem 题目
     * @return 结果
     */
    @Override
    public int insertProblem(Problem problem)
    {
        problem.setCreateTime(DateUtils.getNowDate());
        return problemMapper.insertProblem(problem);
    }

    /**
     * 修改题目
     *
     * @param problem 题目
     * @return 结果
     */
    @Override
    public int updateProblem(Problem problem)
    {
        problem.setUpdateTime(DateUtils.getNowDate());
        return problemMapper.updateProblem(problem);
    }

    /**
     * 批量删除题目
     *
     * @param ids 需要删除的题目主键
     * @return 结果
     */
    @Override
    public int deleteProblemByIds(Long[] ids)
    {
        return problemMapper.deleteProblemByIds(ids);
    }

    /**
     * 删除题目信息
     *
     * @param id 题目主键
     * @return 结果
     */
    @Override
    public int deleteProblemById(Long id)
    {
        return problemMapper.deleteProblemById(id);
    }
}
